﻿using System;
using System.Collections.Generic;
using System.Text;
using log4net.Config;

namespace smforj.common.util
{
    /// <summary>
    /// 操作日志
    /// </summary>
    public class LogManage
    {
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        private string configFile = "";
        public LogManage()
        { 
            configFile = AppDomain.CurrentDomain.BaseDirectory + @"Log.config";
            XmlConfigurator.Configure(new System.IO.FileInfo(configFile));
        }
        //获取Log4net文件的路径

        /// <summary>
        /// 日志信息
        /// </summary>
        /// <param name="strMessage"></param>
        public void Info(object strMessage)
        {
            log.Info(strMessage);
        }
        /// <summary>
        /// 警告日志
        /// </summary>
        /// <param name="strMessage"></param>
        public void Warn(object strMessage)
        {
            log.Warn(strMessage);
        }
        /// <summary>
        /// 调试日志
        /// </summary>
        /// <param name="strMessage"></param>
        public void Debug(object strMessage)
        {
            log.Debug(strMessage);
        }
        /// <summary>
        /// 错误日志
        /// </summary>
        /// <param name="strMessage"></param>
        public void Error(object strMessage)
        {
            log.Error(strMessage);
        }
    }
}
